package cn.ichiva.dl.tushare.tu.predict;

import cn.ichiva.dl.tushare.tu.data.Shibor;
import cn.ichiva.dl.tushare.tu.data.Daily;

public class DecisionUtils {


    /**
     * 获取股票数据
     * @param ts_code
     * @param day
     * @return
     */
    public static String[] getStockByDay(Daily daily,String ts_code,String day){
       return daily.get(ts_code,day,day).get().getItems()[0];
    }

    /**
     * 获取利率数据
     * @param day
     * @return
     */
    public static String[] getShiborByDay(Shibor shibor, String day){
        return shibor.get(day, day).get().getItems()[0];
    }

    /**
     * 获取股票和利率数据
     * @param ts_code
     * @param day
     * @return
     */
    public static String[] getStockAndRate(Daily daily,Shibor shibor,String ts_code,String day){
        String[] stockByDay = getStockByDay(daily,ts_code, day);
        String[] shiborByDay = getShiborByDay(shibor,day);

        String[] res = new String[stockByDay.length + shiborByDay.length - 3];
        System.arraycopy(stockByDay,2,res,0,stockByDay.length -2);
        System.arraycopy(shiborByDay,1,res,stockByDay.length -2 ,shiborByDay.length -1);

        return res;
    }
}
